import { Map } from "immutable";
import {
  CHANGE_MY_NOTE,
  CHANGE_MY_COLLECT_NOTE,
  CHANGE_OTHER_USER_INFO,
} from "./constant";
const initState = Map({
  otherUserInfo: {},
  myNote: [],
  myCollectNote: [],
});

export default function reducer(state = initState, { type, data }) {
  switch (type) {
    case CHANGE_OTHER_USER_INFO:
      return state.set("otherUserInfo", data);
    case CHANGE_MY_NOTE:
      return state.set("myNote", data);
    case CHANGE_MY_COLLECT_NOTE:
      return state.set("myCollectNote", data);
    default:
      return state;
  }
}
